<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>New quality humor images for the last 5 days</title>
<meta name="" content="">
<link rel=stylesheet href="css/daily-giggle.css" type="text/css" media=screen>
<script src="js/HttpRequest.js"></script>
<script src="js/Position.js"></script>
<script src="js/DateFormatter.js"></script>
<script src="js/Effects.js"></script>
<script src="js/UploadManager.js"></script>
</head>

<?php
require_once('php/ImageRenderManager.php');
?>

<body style="background-image: url(images/daily-giggle-background.jpg);">

<?php showHeader(); ?>

<table border="0">
	<tbody class="image_desc" style="text-align: center;">
	<tr style="height: 10px;">
		<td style="width: 260px;">&nbsp;</td>
		<td style="border-style: solid; border-width: 1px; text-align: center; width: 640px; font-weight: 
                    bold; font-size: 16px; background-color: #e6e6ff; color: #000028; height: 10px;">
			    <?php print(date('j F, Y')); ?>
		</td>
		<td rowspan="2" style="width: 151px; vertical-align: top; text-align: center; padding-top: 0;">
			<div class="image_desc" style="background-color: #e6e6ff; padding: 5px; border-style: dashed; border-width: 1px; text-align: center;">
				Delivering new humorous pictures every day! Each funny image is carefully selected for originality and sophistication! 
			</div>
			<table border="0">
				<tbody class="image_desc" style="text-align: center;">
				<tr style="height: 5px;"><td></td></tr>
				<tr><td><a href="quality_humor_manifesto.php">Quality Humor Manifesto</a></td></tr>
				<tr style="height: 5px;"><td></td></tr>
				<tr>
					<td>
						<div style="text-align: center;">
                            <a href="iphone_download_instructions.php">
							    <img alt="iPhone download instructions" src="images/daily-giggle-iphone-download.png">
                            </a>
						</div>
					</td>
            	</tr>
				<tr style="height: 200px;"><td></td></tr>
				<tr><td><img src="images/short-horizontal-line.png"/></td></tr>
				<tr>
					<td style="text-align: center; vertical-align: bottom;">
                       <img alt="Submit a new funny image" src="images/submit-new-image.png" style="cursor: pointer;" onclick="toggleSubmitPanel(this);">
					</td>
            	</tr>
				<tr style="height: 2px;"><td></td></tr>
				<tr>
                    <td>
                        <div class="image_desc" style="background-color: #e6e6ff; padding: 5px; 
                                    border-style: dashed; border-width: 1px; text-align: center;">
            			Contact us:<br>
            			<a href="mailto:admin@daily-giggle.net">admin@daily-giggle.net</a></div>
                    </td>
                </tr>                
				</tbody>
			</table>
		</td>
		<td style="width: 200px;">&nbsp;</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td style="border-style: solid; border-width: 1px;">
            
            <?php
                //Get the image information for today's image 
                $row = dbGetImageInfoByPublishDate(date('Y-m-d'));
            ?>
			
            <img style="width: 640px" alt="<?php print($row['description']); ?>" src="php/get_image_by_publish_date.php?publish_date=<?php print(date('Y-m-d')); ?>">
		</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td class="image_desc" style="border-style: solid; border-width: 1px; text-align: center;
							   background-color: #e6e6ff; padding: 5px; color: #000028">
			<?php print($row['description']); ?><br>
			<a href="<?php print($row['source']); ?>"><?php print($row['source']); ?></a>
		</td>
		<td></td>
		<td>&nbsp;</td>
	</tr>
	<tr style="height: 15px;">
		<td colspan="4"></td>
	</tr>
	</tbody>
</table>

<?php
    displayImagesByPublishDate(new DateTime(date('Y-m-d', strtotime("-1 day"))), 4);
?>

<!-- An additional submit used to submit a new image. Activated on user clicking the "Submit" button -->
<div id="submit_panel" style="position: absolute; top: 100px; left: 100px; width: 420px; height: 330px; background-color: black; opacity: 0.90; filter: alpha(opacity = 90); visibility: hidden;">
    <form id="file_upload_form" method="post" enctype="multipart/form-data" action="php/upload.php" target="upload_target"
              style="position: relative; top: 20px; text-align: center; visibility: hidden;"> 
        <table style="text-align: left; width: 90%; margin-left: auto; margin-right: auto; font-size: 8pt;" border="0" cellpadding="3" cellspacing="3">
            <tr>
                <td style="color: white; text-align: right; width: 100%;">Description</td>
                <td><input id="fuf_description" name="fuf_description" size="28" style="width: 100%;" type="text" onchange="tryEnableUploadSubmitButton();"></td>
            </tr>
            <tr>
                <td style="color: white; text-align: right; width: 100%;">Source</td>
                <td><input id="fuf_source" name="fuf_source" size="28" type="text" style="width: 100%" onchange="tryEnableUploadSubmitButton();"></td>
            </tr>
            <tr>
                <td style="color: white; text-align: right; width: 100%;">Email</td>
                <td><input id="fuf_email" name="fuf_email" size="28" type="text" style="width: 100%" onchange="tryEnableUploadSubmitButton();"></td>
            </tr>
            <tr>
                <td style="color: white; text-align: right; width: 100%">File</td>
                <td>
                    <input name="fuf_file" id="fuf_file" size="18" onchange="tryEnableUploadSubmitButton();" type="file">
                </td>
            </tr>
            <tr>
                <td colspan="2" rowspan="1"></td>
            </tr>
            <tr>
                <td colspan="2" rowspan="1" style="text-align: right;">
                    <input id="fuf_submit" value="Upload" type="submit">&nbsp&nbsp
                    <input id="fuf_reset" value="Reset" type="reset" onclick="resetUploadForm();">&nbsp&nbsp
                    <input id="fuf_cancel" value="Cancel" onclick="toggleSubmitPanel(null);" type="button">
                </td>
            </tr>
            <tr>
                <td colspan="2" rowspan="1"></td>
            </tr>
        </table>
        <iframe id="upload_target" name="upload_target" src="" style="border: 1px solid gray; width: 380px; height: 110px; background-color: white;" onload="resetUploadForm();">
        </iframe>
    </form>
</div>

<div id="test_panel" style='position: absolute; top: 0px; left: 260px; width: 810px; height: 1px; background-color: yellow;'></div>

</body>
</html>